package com.kantboot.system.user.web.controller;

import com.kantboot.system.user.domain.vo.SysUserOfSelfVO;
import com.kantboot.system.user.service.ISysUserBindService;
import com.kantboot.util.common.result.RestResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/system-user-web/userBind")
public class SysUserBindController {
//
//    /**
//     * 临时用户根据手机号码+验证码绑定
//     * @param phone 手机号码
//     * @param varCode 验证码
//     * @return 登录VO
//     */
//    SysUserOfSelfVO bindWithPhoneAndVarCodeAtTemporary(String phone, String varCode);
//
//    /**
//     * 临时用户根据邮箱+验证码绑定
//     * @param email 邮箱
//     * @param varCode 验证码
//     * @return 登录VO
//     */
//    SysUserOfSelfVO bindWithEmailAndVarCodeAtTemporary(String email, String varCode);
//
//    /**
//     * 临时用户根据手机号码+验证码绑定（安全）
//     * @param phone 手机号码
//     * @param varCode 验证码
//     * @return 登录VO
//     */
//    SysUserOfSelfVO bindWithPhoneAndVarCodeAtTemporaryWithSecurity(String phone, String varCode);
//
//    /**
//     * 临时用户根据邮箱+验证码绑定（安全）
//     * @param email 邮箱
//     * @param varCode 验证码
//     * @return 登录VO
//     */
//    SysUserOfSelfVO bindWithEmailAndVarCodeAtTemporaryWithSecurity(String email, String varCode);
//
//    /**
//     * 跳过临时绑定
//     */
//    SysUserOfSelfVO skipTemporaryBind();
//

    @Resource
    private ISysUserBindService sysUserBindService;

    @PostMapping("/bindWithPhoneAndVarCodeAtTemporary")
    public RestResult<SysUserOfSelfVO> bindWithPhoneAndVarCodeAtTemporary(
            @RequestParam("phone") String phone,
            @RequestParam("varCode") String varCode) {
        return RestResult.success(sysUserBindService.bindWithPhoneAndVarCodeAtTemporary(phone, varCode),"bindSuccess","绑定成功");
    }

    @PostMapping("/bindWithEmailAndVarCodeAtTemporary")
    public RestResult<SysUserOfSelfVO> bindWithEmailAndVarCodeAtTemporary(
            @RequestParam("email") String email,
            @RequestParam("varCode") String varCode) {
        return RestResult.success(sysUserBindService.bindWithEmailAndVarCodeAtTemporary(email, varCode),"bindSuccess","绑定成功");
    }

    @PostMapping("/bindWithPhoneAndVarCodeAtTemporaryWithSecurity")
    public RestResult<SysUserOfSelfVO> bindWithPhoneAndVarCodeAtTemporaryWithSecurity(
            @RequestParam("phone") String phone,
            @RequestParam("varCode") String varCode) {
        return RestResult.success(sysUserBindService.bindWithPhoneAndVarCodeAtTemporaryWithSecurity(phone, varCode),"bindSuccess","绑定成功");
    }

    @PostMapping("/bindWithEmailAndVarCodeAtTemporaryWithSecurity")
    public RestResult<SysUserOfSelfVO> bindWithEmailAndVarCodeAtTemporaryWithSecurity(
            @RequestParam("email") String email,
            @RequestParam("varCode") String varCode) {
        return RestResult.success(sysUserBindService.bindWithEmailAndVarCodeAtTemporaryWithSecurity(email, varCode),"bindSuccess","绑定成功");
    }

    /**
     * 跳过临时绑定
     * @return
     */
    @PostMapping("/skipTemporaryBind")
    public RestResult<SysUserOfSelfVO> skipTemporaryBind() {
        return RestResult.success(sysUserBindService.skipTemporaryBind(),"skipSuccess","跳过成功");
    }

}
